home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ian & Stuart's Australian Mac 1993 September
/
clonecd
/
September 93.img
/
Archives
/
Decoration
/
Screensavers
/
Screen Savers
/
TwilightZone
/
source
/
trapavailable.c
< prev
next >
Wrap
Text File
|
1992-06-01
|
1KB
|
58 lines
/*-------------------------------------------------------------------------------------
*
* Simple Sample Application Framework
*
* ©1991 Apple Computer
*
-------------------------------------------------------------------------------------*/
/*
* trapavailable.c -- checks to see if a trap is implemented
*
* change history:
*
* SJF 11/6/91 1.0d1 initial coding
*
*/
#include <Types.h>
#include <Traps.h>
#include <OSUtils.h>
#include <GestaltEqu.h>
#include "trapavailable.h"
short NumToolboxTraps(void);
TrapType GetTrapType(short theTrap);
short NumToolboxTraps(void)
{
if (NGetTrapAddress(_InitGraf, ToolTrap) == NGetTrapAddress(0xAA6E,ToolTrap))
return 0x0200;
else
return 0x0400;
}
TrapType GetTrapType(short theTrap)
{
if ((theTrap & 0x0800) > 0)
return ToolTrap;
else
return OSTrap;
}
Boolean TrapAvailable(short theTrap)
{
TrapType tType;
Boolean isAvail;
tType = GetTrapType(theTrap);
if (tType == ToolTrap)
{
theTrap &= 0x07FF;
if (theTrap >= NumToolboxTraps())
theTrap = _Unimplemented;
}
isAvail = NGetTrapAddress(theTrap, tType) != NGetTrapAddress(_Unimplemented, ToolTrap);
return isAvail;
}